package com.cloud.sms.service;

import com.cloud.sms.dao.SmsDefenseParamMapper;
import com.cloud.sms.interceptor.ServiceException;
import com.cloud.sms.model.SmsDefenseParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @describe 短信防御参数
 * 
 * @author ruanpeng
 * @date 2014年7月19日
 */
@Service
public class SmsDefenseParamService {

	@Autowired
	private SmsDefenseParamMapper smsDefenseParamMapper;

	public int insertSelective(SmsDefenseParam model) throws ServiceException {
		int len;
		try {
			len = smsDefenseParamMapper.insertSelective(model);
		} catch (Exception e) {
			e.printStackTrace();
			throw new ServiceException();
		}
		return len;
	}

	public int deleteByPrimaryKey(int id) throws ServiceException {
		int len;
		try {
			len = smsDefenseParamMapper.deleteByPrimaryKey(id);
		} catch (Exception e) {
			e.printStackTrace();
			throw new ServiceException();
		}
		return len;
	}

	public int updateByPrimaryKeySelective(SmsDefenseParam model) throws ServiceException {
		int len;
		try {
			len = smsDefenseParamMapper.updateByPrimaryKeySelective(model);
		} catch (Exception e) {
			e.printStackTrace();
			throw new ServiceException();
		}
		return len;
	}

	public SmsDefenseParam selectByPrimaryKey(int id) {
		return smsDefenseParamMapper.selectByPrimaryKey(id);
	}
	
}
